package com.e7.service;

import org.springframework.stereotype.Service;

import com.e7.util.Mailer;

@Service("mailService")
public class MailService {
	private Mailer mailer = new Mailer("smtp.163.com");

	public void setAuthInfo(String email, String password) {
		this.mailer.setAuthInfo(email, password);
	}

	/**
	 * 
	 * @param email
	 *            dest mailbox
	 * @return
	 */
	public boolean sendVerification(String emails) {
		String body = "this is the verification info";
		return this.mailer.send("[E7] Mailbox Verification", emails, body);
	}

	/**
	 * 
	 * @param email
	 *            dest mailbox
	 * @return
	 */
	public boolean sendNewPassword(String email) {
		String body = "this is your new password";
		return this.mailer.send("[E7] Password Retrieval", email, body);
	}

	/**
	 * 
	 * @param emails
	 *            comma separated dest mailboxes
	 * @return
	 */
	public boolean sendNotification(String emails) {
		String body = "this is the notification body";
		return this.mailer.send("[E7] Password Retrieval", emails, body);
	}
}
